//
//  LTView.m
//  Lesson8HomeWork
//
//  Created by 周琦 on 15/9/26.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "LTView.h"

@interface LTView ()

@property (nonatomic, retain) UIImageView *userImage;
@property (nonatomic, retain) UILabel *userName;
@property (nonatomic, retain) UILabel *words;
@property (nonatomic, retain) UILabel *date;
@property (nonatomic, retain) UILabel *bottomLine;

@end
@implementation LTView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createLTViewSubViews];
    }
    return self;
}

- (void)createLTViewSubViews
{
    self.userImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 60, 60)];
    _userImage.image = [UIImage imageNamed:@"1-nomal"];
    _userImage.layer.cornerRadius = 30;
    [self addSubview:_userImage];
    [_userImage release];
    
    self.userName = [[UILabel alloc] initWithFrame:CGRectMake(_userImage.frame.origin.x + _userImage.frame.size.width + 5, _userImage.frame.origin.y, self.frame.size.width - _userImage.frame.origin.x - _userImage.frame.size.width, _userImage.frame.size.height / 2)];
    self.userName.text = @"用户名";
    _userName.font = [UIFont systemFontOfSize:20];
    [self addSubview:_userName];
    [_userName release];
    
    self.words = [[UILabel alloc] initWithFrame:CGRectMake(_userName.frame.origin.x, _userName.frame.origin.y + _userName.frame.size.height, _userName.frame.size.width, _userName.frame.size.height)];
    _words.font = [UIFont systemFontOfSize:16];
    _words.text = @"发送的消息";
    _words.numberOfLines = 1;
    [self addSubview:_words];
    [_words release];
    
    self.bottomLine = [[UILabel alloc] initWithFrame:CGRectMake(0, _userImage.frame.origin.y + _userImage.frame.size.height + 5, self.frame.size.width, 1)];
    _bottomLine.backgroundColor = [UIColor blackColor];
    [self addSubview:_bottomLine];
    [_bottomLine release];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
